package com.cjm.mybatis.MybatisUtil;

import com.cjm.mybatis.test2.Test2;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;

/**
 * Created by jiaming.chen1 on 2015/7/7.
 */
public class MybatisUtils {
    public static SqlSessionFactory getFactory(){
        String resource = "conf.xml";
        InputStream is = Test2.class.getClassLoader().getResourceAsStream(resource);

        SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(is);
        return factory;
    }
}
